<template>
  <div>
    <el-table :data="tableData" style="width: 100%; height: 200px" v-loading="loading" max-height="600">
      <el-table-column prop="date" label="币种" align="center">
        <template slot-scope="scope">
          <i class="el-icon-star-on"></i>
          {{scope.row.cnName}}
        </template>
      </el-table-column>
      <el-table-column prop="available" label="可用" align="center"/>
      <el-table-column prop="freez" label="冻结" align="center"/>
    </el-table>
  </div>
</template>

<script>
  import {getPosition} from '@/api/modules/platformAccount'

  export default {
    name: "NowPosition",
    props: {
      currency: {
        type: String,
        default: 'BTC-USDT'
      }
    },
    data() {
      return {
        tableData: [],
        loading: true,
      }
    },
    created() {
      console.log("当前持仓刷新了")
      this.loading = true
      this.getAccount()
    },
    methods: {
      rowClick(row, event, column) {
        this.loading = true
        Array.prototype.remove = function (val) {
          let index = this.indexOf(val);
          if (index > -1) {
            this.splice(index, 1);
          }
        };
        if (this.expands.indexOf(row.id) < 0) {
          this.expands = []
          this.expands.push(row.id);
        } else {
          this.expands.remove(row.id);
        }
      },
      getAccount() {
        console.log("平台", this.platForm)
        getPosition({currency: this.currency}).then(res => {
          console.log("账户信息", res)
          this.tableData = res.data
        })
        this.loading = false
      }
    }
  }
</script>

<style scoped>

</style>
